class_name EntityBehavior
extends Node

@export var func_node:Node
@export var componets_parent:Node
var entity = Entity.new()

func _ready() -> void:
	var attach_node = get_parent()
	entity.attach_node = attach_node
	entity.func_node = func_node
	attach_node.set_meta("Entity",entity)
	await entity.attach_node.ready
	if not is_instance_valid(componets_parent):
		return
	for child in componets_parent.get_children():
		if child is ComponentBehavior:
			var comp = child.component.duplicate(false)
			child.component = comp
			child.set_up(entity)
			entity.add_component(comp)
